package com.gc.tpas.dao;

import com.gc.tpas.entity.QaInfo;
import com.gc.tpas.entity.QaUser;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * Created by Administrator on 2018/5/7 0007.
 */
@SuppressWarnings("JpaQlInspection")
public interface QaInfoDao extends JpaRepository<QaInfo,Integer> {

/*    @Query("select e.extype from qa_info e where e.qatype like :key")
    List<Object> findQaType(@Param("key") String key);*/

    /**
     * 查询指定用户发布的问答
     * @param u
     * @return
     */
    List<QaInfo> findByPublisherOrderByCreatetimeDesc(QaUser u);

    /**
     * 查询未解决异常
     * @param flag
     * @return
     */
    List<QaInfo> findBySolutionflagOrderByCreatetimeDesc(Integer flag);

    /**
     * 查询指定用户提供的主要方案解决的异常
     * @param flag
     * @param user
     * @return
     */
    List<QaInfo> findBySolutions_MainflagAndSolutions_ProviderOrderByCreatetimeDesc(Integer flag,QaUser user);

    /**
     * 查询指定用户参与的异常
     * @param user
     * @return
     */
    List<QaInfo> findBySolutions_ProviderOrderByCreatetimeDesc(QaUser user);

    List<QaInfo> findByIdAndSolutions_Mainflag(Integer id,Integer flag);


}
